﻿
CREATE TABLE [dbo].[CA_ProductType](
	[S_ID] [nvarchar](50) NOT NULL,
	[ProductTypeID] [nvarchar](100) NULL,
	[ProductTypeName] [nvarchar](200) NULL,
	[Note] [nvarchar](500) NULL,
 CONSTRAINT [PK_CA_ProductType] PRIMARY KEY CLUSTERED 
(
	[S_ID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

GO
ALTER TABLE [dbo].[CA_ProductType] ADD  CONSTRAINT [DF_CA_ProductType_S_ID]  DEFAULT (newid()) FOR [S_ID]
GO


Create proc [dbo].[CA_ProductType_ADD](@ProductTypeID nvarchar(100),@ProductTypeName nvarchar(200),
@Note nvarchar(500))
as
begin
INSERT INTO [CA_ProductType]
           ([ProductTypeID]
           ,[ProductTypeName]
           ,[Note])
     VALUES
           (@ProductTypeID, 
           @ProductTypeName,
           @Note)
end

GO

Create proc [dbo].[CA_ProductType_SEL]
as
begin
SELECT [S_ID]
      ,[ProductTypeID]
      ,[ProductTypeName]
      ,[Note]
  FROM [CA_ProductType]
  order by [ProductTypeID]
end

GO
Create proc [dbo].[CA_ProductType_SRH]
as
begin
SELECT [S_ID]
      ,[ProductTypeID]
      ,[ProductTypeName]
      ,[Note]
  FROM [CA_ProductType]
  order by [ProductTypeID]
end